/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upc.clase.demo.service.impl;

import edu.upc.clase.demo.dao.BancoDao;
import edu.upc.clase.demo.dao.impl.BancoDaoImpl;
import edu.upc.clase.demo.entity.Banco;
import edu.upc.clase.demo.service.BancoService;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 *
 * @author operador
 */
@Service 
public class BancoServiceImpl implements BancoService {
    private static Logger log = LoggerFactory.getLogger(BancoDaoImpl.class);    
    
    @Autowired
    private BancoDao bancoDao;

    @Override
    public Integer insertar(Banco banco) {
        if (banco.getNobanco().length() > 0) {
            log.info("Creando Banco");
            return bancoDao.insertar(banco);
        }       
        return null;
    }

    @Override
    public void actualizar(Banco banco) {
        log.info("Actualizando Banco");
        bancoDao.actualizar(banco);
    }

    @Override
    public void eliminar(Banco banco) {
        log.info("Eliminando Banco");
        bancoDao.eliminar(banco);
    }

    @Override
    public List<Banco> buscarTodos() {
        log.info("Buscando todos los bancos");
        return bancoDao.buscarTodos();
    }

    @Override
    public Banco buscar(Integer id) {
        log.info("Buscar banco por idbanco");
        return bancoDao.buscar(id);
    }

   
    @Override
    public List<Banco> buscarPorNombre(String nombre) {
        return bancoDao.buscarPorNombre(nombre);
    }    
    
}
